package info

import (
	"errors"
	"os"
	"path"

	"gitee.com/chuanjinge/go-container/config"
	"gitee.com/chuanjinge/go-container/container/containerconfig"
)

// 删除容器信息的存储文件
func RemoveConfigLog(containerId string) error {
	configLogfile := containerconfig.GetConfigLog(containerId)
	return os.Remove(configLogfile)
}

// 删除容器运行信息的存储文件
func RemoveRunLog(containerId string) error {
	runLogfile := containerconfig.GetRunLogPath(containerId)
	return os.Remove(runLogfile)
}

// 当dir为空的时候移除该目录
func RemoveContainerDir(containerId string) error {
	if containerId == "" {
		return errors.New("容器ID为空")
	}

	return os.Remove(path.Join(config.GlobalConfig().ContainerPath, containerId))
}
